package com.news.activity;

import com.xiang.news.R;
import com.umeng.fb.FeedbackAgent;
import com.umeng.socialize.controller.RequestType;
import com.umeng.socialize.controller.UMServiceFactory;
import com.umeng.socialize.controller.UMSocialService;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.RelativeLayout;

public class SettingsActivity extends Activity implements OnClickListener {
	private ImageView img_back;

	private RelativeLayout rl_feedback;
	private RelativeLayout rl_comment;
	private RelativeLayout rl_about;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.settings_layout);

		img_back = (ImageView) findViewById(R.id.settings_back);

		rl_feedback = (RelativeLayout) findViewById(R.id.setting_rl_feedback);
		rl_comment = (RelativeLayout) findViewById(R.id.setting_rl_comment);
		rl_about = (RelativeLayout) findViewById(R.id.setting_rl__about);

		rl_feedback.setOnClickListener(this);
		rl_comment.setOnClickListener(this);
		rl_about.setOnClickListener(this);
		img_back.setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		int Vid = v.getId();
		switch (Vid) {
		// 友盟 评论
		case R.id.setting_rl_comment:
			UMSocialService controller01 = UMServiceFactory.getUMSocialService(
					"NEWS", RequestType.SOCIAL);
			controller01.openComment(this, false);
			break;
		// 问题反馈
		case R.id.setting_rl_feedback:
			// UMFeedbackService.openUmengFeedbackSDK(this);
			FeedbackAgent agent = new FeedbackAgent(this);
			agent.startFeedbackActivity();
			break;
		// 关于
		case R.id.setting_rl__about:
			Intent intent = new Intent( this, AboutActivity.class);
			startActivity(intent);
			overridePendingTransition(R.anim.right_in, R.anim.left_out);
			break;
		// 关闭界面
		case R.id.settings_back:
			this.finish();
			overridePendingTransition(R.anim.left_in, R.anim.right_out);
			break;

		default:
			break;
		}
	}
	
	@Override
	public void onBackPressed() {
		this.finish();
		overridePendingTransition(R.anim.left_in, R.anim.right_out);
		super.onBackPressed();
	}

}
